﻿using System.Configuration;

namespace Higgs.Web.AtomPub.Configurations
{
    public class AcceptTypeElementCollection : ConfigurationElementCollection
    {
        public new AcceptTypeElement this[string key]
        {
            get { return (AcceptTypeElement) BaseGet(key); }
        }

        public AcceptTypeElement this[int index]
        {
            get { return (AcceptTypeElement) BaseGet(index); }
        }

        public override ConfigurationElementCollectionType CollectionType
        {
            get { return ConfigurationElementCollectionType.AddRemoveClearMap; }
        }

        protected override ConfigurationElement CreateNewElement()
        {
            return new AcceptTypeElement();
        }

        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((AcceptTypeElement) element).MimeType;
        }

        public void Add(AcceptTypeElement at)
        {
            BaseAdd(at);
        }

        public void Remove(string key)
        {
            BaseRemove(key);
        }
    }
}
